import matplotlib as mpl
import matplotlib.pyplot as plt

def plot_binary(some_digit_image):
    plt.imshow(some_digit_image, cmap="binary")
    plt.axis("off")
    return plt

def plot_precision_recall_vs_threshold(precisions, recalls, thresholds):
  plt.plot(thresholds, precisions[:-1], "b--", label="Precision")
  plt.plot(thresholds, recalls[:-1], "g-", label="Recall")
  return plt
  # highlight the threshold and add the legend, axis label, and grid

def plot_precision_recall(precisions, recalls, thresholds):
   plt.plot(thresholds, recalls[:-1], "g-", label="Recall")
   return plt

def histogram(df, colname, num_bins=20, figscale=1):
  df[colname].plot(kind='hist', bins=num_bins, title=colname, figsize=(8*figscale, 4*figscale))
  plt.gca().spines[['top', 'right',]].set_visible(False)
  plt.tight_layout()

# fig.savefig('output/my_figure.png')
# from IPython.display import Image 
# Image('output/my_figure.png')